<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.3.3/css/swiper.min.css">
  <script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}"></script>
  <script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.1.1.3.min.js{$Think.config.RESOURCE_VER}"></script>
  <script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.3.3/js/swiper.min.js"></script>
  <title>海报</title>
  <style>
    html, body {
      background: #fff;
      position: relative;
      height: 100%;
    }
    body {
      background: #eee;
      font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
      font-size: 14px;
      color:#000;
      margin: 0;
      padding: 0;
    }
    .swiper-container {
      width: 100vw;
      height: 100vh;
    }
    .swiper-slide {
      width: 80%;
      display: flex;
      align-items: center;
    }
    img {
      width: 100%;
      margin: 0 auto;
      display: block;
      box-shadow: 4px 6px 20px rgba(0, 0, 0, .5);
      border-radius: 10px;
    }
    .page-index {
      position: fixed;
      right: 0;
      bottom: 0;
      z-index: 1000;
      text-align: right;
      padding: 20px;
    }
    .index {
      font-size: 20px;
      color: #f75493;
    }
  </style>
</head>
<body>
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <volist name="results" id="vo">
          <div class="swiper-slide">
            <img src="{$vo.qrImgUrl}">
          </div>
        </volist>
      </div>
    </div>
    <div class="page-index"></div>
  </div>
  <script>
    var len = JSON.parse('{$results | json_encode}').length
    var swiper = new Swiper('.swiper-container', {
      activeIndex: 0,
      notNextTick: true,
      mousewheelControl: true,
      slidesPerView: 'auto',
      observer: true,
      observeParents: true,
      centeredSlides: true,
      watchSlidesProgress: true,
      loop: len > 1,
      loopedSlides: 2,
      on: {
        progress: function(swiper) {
          var slide, progress, style, scale
          for (var i = 0; i < this.slides.length; i++) {
            slide = this.slides[i]
            progress = slide.progress
            style = slide.style
            scale = 1 - Math.min(Math.abs(0.2 * progress), 1)
            style.opacity = 1 - Math.min(Math.abs(progress / 2), 1)
            style.transform = 'scale(' + scale + ')'
          }
        },
        setTransition: function(progress, b) {
          for (var i = 0; i < this.slides.length; i++) {
            this.slides[i].style.transitionDuration = b + 'ms'
          }
        },
        transitionEnd: function(swiper) {
          $('.page-index').html('<span class="index">' + (this.realIndex + 1) + '</span>/'+ len)
        }
      }
    })
  </script>
</body>
</html>